/*
 *  Copyright (C) 2010 Glauco
 * 
 *  This program is free software: you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation, either version 3 of the License, or
 *  (at your option) any later version.
 * 
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 * 
 *  You should have received a copy of the GNU General Public License
 *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

package org.balisunrise.swing.components.panel;

import javax.swing.JPanel;
import org.balisunrise.swing.components.panel.layouts.TransactionLayoutBuilder;

/**
 *
 * @author Glauco
 */
public class TransactionPanel extends JPanel{
    
    private JPanel actionPanel;
    private JPanel editorPanel;
    private JPanel searchPanel;
    private TransactionLayoutBuilder layoutBuilder;

    public TransactionPanel(JPanel actionPanel, JPanel editorPanel,
            JPanel searchPanel, TransactionLayoutBuilder layoutBuilder) {

        this.actionPanel = actionPanel;
        this.editorPanel = editorPanel;
        this.searchPanel = searchPanel;
        this.layoutBuilder = layoutBuilder;

    }

    public JPanel getActionPanel() {
        return actionPanel;
    }

    public void setActionPanel(JPanel actionPanel) {
        this.actionPanel = actionPanel;
    }

    public JPanel getEditorPanel() {
        return editorPanel;
    }

    public void setEditorPanel(JPanel editorPanel) {
        this.editorPanel = editorPanel;
    }

    public TransactionLayoutBuilder getLayoutBuilder() {
        return layoutBuilder;
    }

    public void setLayoutBuilder(TransactionLayoutBuilder layoutBuilder) {
        this.layoutBuilder = layoutBuilder;
    }

    public JPanel getSearchPanel() {
        return searchPanel;
    }

    public void setSearchPanel(JPanel searchPanel) {
        this.searchPanel = searchPanel;
    }

    public void showEditor(){

        layoutBuilder.setActionPanel(actionPanel);
        layoutBuilder.setComponent(editorPanel);
        layoutBuilder.buildLayout(this);
    }

    public void showSearch(){

        layoutBuilder.setActionPanel(actionPanel);
        layoutBuilder.setComponent(searchPanel);
        layoutBuilder.buildLayout(this);
    }
}
